/*
* Copyright (c) 2008, Vladimir Gumenuk
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*     * Redistributions of source code must retain the above copyright
*       notice, this list of conditions and the following disclaimer.
*     * Redistributions in binary form must reproduce the above copyright
*       notice, this list of conditions and the following disclaimer in the
*       documentation and/or other materials provided with the distribution.
*     * Neither the name of the copyright holder nor the
*       names of its contributors may be used to endorse or promote products
*       derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef __GNX4_H__
#define __GNX4_H__

//////////////////////////////////////////////////////////////////////////
// This file is created by using 4 tools: GNX4 Guitar Workstation, PC, X-Edit, and brain.
// There are many unclear places that must be investigated (and I hope will be soon...)
// The most parameters are stored in words. Normally, the device and official editor limits
// the possible value that can be assigned to the parameter by specified range 
// (for ex.: 0-99 for the most of parameters). However nothing permits to assign the value greater or
// lower from the specified range. I have never do this. I don't know what can happen with the
// device in case you supply incorrect parameters. So, be careful and do it on your own risk.
//////////////////////////////////////////////////////////////////////////

#pragma pack(1)

// 10 valid characters, without NULL terminator
#define GNX_MAXNAME_LEN  11
#define GNX_AMP_DATASIZE 588
#define GNX_CAB_DATASIZE 256

#define MAX_AMP_NAME                11
#define NUM_CAB_ZREGS               128
#define CAB_ZREG_BLOCK_SIZE         NUM_CAB_ZREGS *2

#define NUM_SPLINE_COEFS            128
#define SPLINE_COEF_BLOCK_SIZE      NUM_SPLINE_COEFS *3

#define NUM_MODEL_EQ_ZREGS          60
#define MODEL_EQ_ZREG_BLOCK_SIZE    NUM_MODEL_EQ_ZREGS *3


// Expression pedal assignment codes (still incomplete)
#define ASGN_None                       0x00000000
#define ASGN_Amp_Chanel                 0x00070104
#define ASGN_Amp_Warp                   0x00070106
#define ASGN_Cabinet_Warp               0x00070107
#define ASGN_Warp                       0x00070105
#define ASGN_Chan1_AmpGain              0x000809C1
#define ASGN_Chan1_AmpLevel             0x000809C2
#define ASGN_Chan2_AmpGain              0x000A09C1
#define ASGN_Chan2_AmpLevel             0x000A09C2
#define ASGN_Wah_Enable                 0x00030081
#define ASGN_Wah_Position               0x00030084
#define ASGN_Pickup_Enable              0x00020041
#define ASGN_Pickup_Type                0x00020040
#define ASGN_Compressor_Enable          0x000400C1
#define ASGN_Compressor_Attack          0x000400C2
#define ASGN_Compressor_Ratio           0x000400C3
#define ASGN_Compressor_Threshould      0x000400C8
#define ASGN_Compressor_Gain            0x000400C9
#define ASGN_WhamISPMod_Enable          0x00050301
    
    #define ASGN_Detune_Amount              0x00050686
    #define ASGN_Detune_Level
    #define ASGN_Whammy_Pedal               0x00050703
    #define ASGN_Whammy_Mix                 0x00050704
    #define ASGN_Whammy_Amount              0x00050705
                  
    #define ASGN_IPS_Amount                 0x00050AC2
    #define ASGN_IPS_Scale
    #define ASGN_IPS_Key
    #define ASGN_IPS_Level
    #define ASGN_Envelope_Sens              0x000E0646
    #define ASGN_Envelope_Range
    #define ASGN_Envelope_Balance
    #define ASGN_Envelope_Mix
#define ASGN_Talker_MicLevel            0x00050B02
#define ASGN_StompBox_Enable            0x00060981
    #define ASGN_StopmBox_Drive             0x00060982
    #define ASGN_StompBox_Tone              0x00060983
    #define ASGN_StompBox_Level_1           0x00060984
    #define ASGN_StompBox_Gain              0x00060996
    #define ASGN_StompBox_Butt              0x00060997
    #define ASGN_StompBox_Face              0x00060998
#define ASGN_StompBox_Distortion        0x0006099C
#define ASGN_StompBox_MidFreq           0x0006099D
#define ASGN_StompBox_MidLevel          0x0006099E
#define ASGN_StompBox_Level             0x000609A1
#define ASGN_StompBox_Low               0x0006099F
#define ASGN_StompBox_High              0x000609A0
    
    #define ASGN_StompBox_Loud              0x00060999
    #define ASGN_StompBox_Drive

#define ASGN_Gate_Enable                0x000C02C1
#define ASGN_Gate_Threshould            0x000C02C6
#define ASGN_Gate_Attack                0x000C02C2
#define ASGN_Gate_PluckSens             0x000C02C7
#define ASGN_Mod_Enable                 0x000E0301
    #define ASGN_Tremolo_Speed              0x000E0484
    #define ASGN_Tremolo_Depth
    #define ASGN_Tremolo_WaveForm
#define ASGN_Rotary_Speed               0x000E0542
#define ASGN_Rotary_Depth               0x000E0544
#define ASGN_Rotary_Doppler             0x000E0546
#define ASGN_Rotary_Mix                 0x000E0545
#define ASGN_Rotary_XOver               0x000E0547
#define ASGN_Rotary_Balance             0x000E0548
    #define ASGN_PitchShift_Amount
    #define ASGN_PitchShift_Level           0x000E06C3
    #define ASGN_PitchShift_Balance         0x000E06C5
    #define ASGN_YaYa_Pedal                 0x000E0582
    #define ASGN_YaYa_Depth                 0x000E0586
    #define ASGN_YaYa_Range                 0x000E0584
    #define ASGN_YaYa_Mix                   0x000E0585
    #define ASGN_YaYa_Balance               0x000E0588
#define ASGN_Delay_Enable               0x000F0741
#define ASGN_Delay_Feedback             0x000F0747
#define ASGN_Delay_DuckThresh           0x000F0748
#define ASGN_Delay_DuckAtten            0x000F0749
#define ASGN_Delay_Level                0x000F0744
#define ASGN_Delay_Balance              0x000F074A
#define ASGN_Reverb_Enable              0x00100781
#define ASGN_Reverb_Predelay            0x00100782
#define ASGN_Reverb_Decay               0x00100787
#define ASGN_Reverb_Level               0x00100785
#define ASGN_Reverb_Balance             0x00100788
#define ASGN_Volume_PedalPreFX          0x000D0A42
#define ASGN_Volume_PedalPostFX         0x00110A42
#define ASGN_LFO1_Speed                 0x00162046
#define ASGN_LFO2_Speed                 0x00172046

typedef struct tagGNX4TblHdr
{
    WORD wVersion;              // 3
    CHAR szBankName1[11];
    BYTE bFlag1;                // ?
    CHAR szBankName2[11];
    BYTE bFlag2;
    CHAR szBankName3[11];
    BYTE bFlag3;
    CHAR szBankName4[11];
    BYTE bFlag4;
    CHAR szBankName5[11];
    BYTE bFlag5;
    CHAR szBankName6[11];
    BYTE bFlag6;
    CHAR szBankName7[11];
    BYTE bFlag7;
    CHAR szBankName8[11];
    BYTE bFlag8;
    CHAR szBankName9[11];
    BYTE bFlag9;
    CHAR szBankName10[11];
    BYTE bFlag10;
    CHAR szBankName11[11];
    BYTE bFlag11;
    CHAR szBankName12[11];
    BYTE bFlag12;
    CHAR szBankName13[11];
    BYTE bFlag13;
    CHAR szBankName14[11];
    BYTE bFlag14;
    CHAR szBankName15[11];
    BYTE bFlag15;
    CHAR szBankName16[11];
    BYTE bFlag16;
    BYTE bUnknownCharTab[160];
} GNX4TblHdr;

//////////////////////////////////////////////////////////////////////////
// this structures definition are from DigiTech specs!
typedef struct tagGenetx_Amp_Tone
{
    WORD    wBass_Freq;
    WORD    wMid_Freq;
    WORD    wHi_Freq;
    WORD    wBass_Level;
    WORD    wMid_Level;
    WORD    wHi_Level;
    WORD    wPresence;
    WORD    wAmp_Gain;
    WORD    wAmp_Level;
} GNX_AMP_TONE;

typedef struct tagGenetx_Amp_Range
{
    DWORD    dwGain_Max;
    DWORD    dwGain_Min;
    DWORD    dwLevel_Max;
    DWORD    dwLevel_Min;
} GNX_AMP_RANGE;

typedef struct tagGenetex_Amp
{
    DWORD               dwSplineCoefData[NUM_SPLINE_COEFS];// array of parameter values
    DWORD               dwModelEqZRegData[NUM_MODEL_EQ_ZREGS];
    GNX_AMP_TONE        def_Tone;
    GNX_AMP_RANGE       def_Range;
    WORD                wDummy;  // added for alignment up to 788 bytes
    WCHAR               wszName[MAX_AMP_NAME]; // name of program
} GNX_AMP;

typedef struct tagEQBandCoef
{
    DWORD   A0, A1, A2, B1, B2;
} EQBANDCOEF;

typedef struct tagProgram_Eq
{
    EQBANDCOEF     GrnBassCoef;
    EQBANDCOEF     GrnMidCoef;
    EQBANDCOEF     GrnTrebCoef;
    EQBANDCOEF     RedBassCoef;
    EQBANDCOEF     RedMidCoef;
    EQBANDCOEF     RedTrebCoef;
} PROGRAM_EQ;

//////////////////////////////////////////////////////////////////////////
// My preset structure definition, updated and corrected from Digitech specs!
typedef struct tagGNX4Preset // 2684 - 0x0A7C - total size 
{
/* 000 */ WORD    wPICKUP_Type;               // 0 - 1  0 - SC>HM, 1 - HM>SC
/* 001 */ WORD    wWAH_OnOff;                 // 0 - 1
/* 002 */ WORD    wWAH_Type;                  // 0 - cry, 1 - boutique, 2 - fulrange
/* 003 */ WORD    wWAH_Pedal;                 // 0 - 99
/* 004 */ WORD    wCOMPRESSOR_OnOff;          // 0 - 1
/* 005 */ WORD    wCOMPRESSOR_Type;    /*!*/  // ?? == 0x0000 in all std presets
/* 006 */ WORD    wCOMPRESSOR_Atack;          // 0 - fast, 1 - medium, 2 - slow
/* 007 */ WORD    wCOMPRESSOR_Threshould;     // 0 - 99
/* 008 */ WORD    wCOMPRESSOR_Ratio;          // 0 - 11 (1.2:1, 1.5:1, 1.8:1, 2.0:1, 2.5:1, 3.0:1, 4.0:1, 5.0:1, 8.0:1, 10:1, 20:1, INFINITY:1
/* 009 */ WORD    wCOMPRESSOR_Gain;           // 0 - 20 (dB)
/* 010 */ WORD    wWHAMMY_IPS_TALK_OnOff;     // 0 - 1
/* 011 */ WORD    wWHAMMY_IPS_TALK_Selection; // 0 - whammy, 1 - ips, 2 - detuner, 3 - pitch, 4-8 - talker1/5
/* 012 */ WORD    wWHAMMY_IPS_PITCH_DETUNER_Level;    // 0 - 99
/* 013 */ WORD    wWHAMMY_Parameter1;         // 0 - 99: whammy no dry signal, ips interval shift, pitch range, detuner amount, talker level
/* 014 */ WORD    wWHAMMY_Parameter2;         // 0 - 99: whammy pedal, IPS scale: 0 - major, 1 - minor, 2 - dorian, 3 - myxolid, 4 - lydian, 5 - harminor
/* 015 */ WORD    wIPS_Key;                   // E - E flat, A == 5 - TO BE INVESTIGATED!
/* 016 */ WORD    wWHAM_PEDAL;        /*!*/   // UNUSED by the device
/* 017 */ WORD    wActiveChanel;              // 0 - green, 1 - red, 2 - warp (yellow)
/* 018 */ WORD    wEQ_Channel;        /*!*/   // ??
/* 019 */ WORD    wGreen_AMP_Type;    /*!*/   // ??
/* 020 */ WORD    wGreen_TONEAMP_Gain;        // 0 - 99
/* 021 */ WORD    wGreen_TONEAMP_Level;       // 0 - 99
/* 022 */ WORD    wGreen_CAB_Type;    /*!*/   // ??
/* 023 */ WORD    wGreen_CABTUNE;             // 0 - 48 - -12.0 +12.0
/* 024 */ WORD    wGreen_BASS_Freq;           // 0 - 250 (50 - 300Hz)
/* 025 */ WORD    wGreen_TONE_BASS;           // 0 - 24 (-12 - +12)
/* 026 */ WORD    wGreen_MID_Freq;            // 0 - 4700 (300-5000Hz)
/* 027 */ WORD    wGreen_TONE_Midrange;       // 0 - 24 (-12 +12)
/* 028 */ WORD    wGreen_TREB_Freq;           // 0 - 7500 (500-8000Hz)
/* 029 */ WORD    wGreen_TONE_TREBE;          // 0 - 24 (-12 - +12)
/* 030 */ WORD    wRed_AMP_Type;     /*!*/    // ??
/* 031 */ WORD    wRed_TONEAMP_Gain;          // 0 - 99
/* 032 */ WORD    wRed_TONEAMP_Level;         // 0 - 99
/* 033 */ WORD    wRed_CAB_Type;     /*!*/    // ??
/* 034 */ WORD    wRed_CABTUNE;               // 0 - 48
/* 035 */ WORD    wRed_BASS_Freq;             // 0 - 250 (50 - 300Hz)
/* 036 */ WORD    wRed_TONE_BASS;             // 0 - 24 (-12 - +12)
/* 037 */ WORD    wRed_MID_Freq;              // 0 - 4700 (300-5000Hz)
/* 038 */ WORD    wRed_TONE_Midrange;         // 0 - 24 (-12 +12)
/* 039 */ WORD    wRed_TREB_Freq;             // 0 - 7500 (500-8000Hz)
/* 040 */ WORD    wRed_TONE_TREBE;            // 0 - 24 (-12 - +12)
/* 041 */ WORD    wNOISEGATE_OnOff;           // 0 - 1
/* 042 */ WORD    wNOISEGATE_Type;            // 0 - silencer, 1 - pluck
/* 043 */ WORD    wNOISEGATE_Threshould;      // 0 - 99
/* 044 */ WORD    wNOISEGATE_Attack;          // 0 - 9
/* 045 */ WORD    wNOISEGATE_Pluck_Sensitivity;   // 0 - 99
/* 046 */ WORD    wCHORUSMOD_OnOff;           // 0 - 1
/* 047 */ WORD    wCHORUSMOD_Type;            // 0 - chorus, 1 - flanger, 2 - phaser, 3 - ... 14 - pitch
/* 048 */ WORD    wCHORUSMOD_Level;           // 0 - 99
/* 049 */ WORD    wCHORUSMOD_Param1;          // 0 - 99 - speed param1
/* 050 */ WORD    wCHORUSMOD_Param2;          // 0 - 99 - depth param2
/* 051 */ WORD    wCHORUSMOD_Param3;          // 0 - 19 - predelay param3
/* 052 */ WORD    wCHORUSMOD_Param4;          // waveform for chorus - 0 - triangle, 1 - sine, 2 - square, and all uneditable for other mod types
/* 053 */ WORD    wCHORUSMOD_Param5;          // LR balance for chorus - 0 - 198
/* 054 */ WORD    wDELAY_OnOff;               // 0 - 1
/* 055 */ WORD    wDELAY_Type;                // 0 - 4
/* 056 */ WORD    wDELAY_Level;               // 0 - 99
/* 057 */ WORD    wDELAY_Time;                // 0 - 2000 ms
/* 058 */ WORD    wDELAY_Feedback;            // 0 - 100
/* 059 */ WORD    wDELAY_Threshould;          // 0 - 100
/* 060 */ WORD    wDELAY_Attenuation;         // 0 - 99
/* 061 */ WORD    wDELAY_LRBalance;           // 0 - 198
/* 062 */ WORD    wREVERB_OnOff;              // 0 - 1
/* 063 */ WORD    wREVERB_Type;               // 0 - 9
/* 064 */ WORD    wREVERB_Level;              // 0 - 99
/* 065 */ WORD    wREVERB_Decay;              // 0 - 99
/* 066 */ WORD    wREVERB_Dumping;            // 0 - 99
/* 067 */ WORD    wREVERB_Predelay;           // 0 - 15
/* 068 */ WORD    wREVERB_LRBalance;          // 0 - 198
/* 069 */ WORD    wWARPY;      /*AMP MORPH*/  // 0 - 99
/* 070 */ WORD    wWARPX;      /*CAB MORPH*/  // 0 - 99
/* 071 */ WORD    wWARPZ;      /*LINK MORPH*/ // 0 - 99
/* 072 */ WORD    wSTOMPBOX_OnOff;            // 0 - 1
/* 073 */ WORD    wSTOMPBOX_Type;             // 0 - 9
/* 074 */ WORD    wSTOMPBOX_Gain;             // 0 - 99
/* 075 */ WORD    wSTOMPBOX_Level;            // 0 - 99
/* 076 */ WORD    wSTOMPBOX_Param1;           // 0 - 99
/* 077 */ WORD    wSTOMPBOX_Param2;           // 0 - 99
/* 078 */ WORD    wMZONE_LowFreq;             // 0 - 99
/* 079 */ WORD    wMZONE_HiLevel;             // 0 - 99
/* 080 */ WORD    wVOLUME_Pre;     /*!*/      // ??
/* 081 */ WORD    wVOLUME_Post;    /*!*/      // ??
/* 082 */ WORD    wEXPPdl1Assign;             // parameter code assigned to expression pedal 1
/* 083 */ WORD    wEXPPdl1Position; /*!*/     // ??         
/* 084 */ WORD    wEXPPdl1Min;                // min value
/* 085 */ WORD    wEXPPdl1Max;                // max value
/* 086 */ WORD    wEXPPdl2Assign;             // param code assigned to exp pdl 2
/* 087 */ WORD    wEXPPdl2Position; /*!*/     // ?? 
/* 088 */ WORD    wEXPPdl2Min;                // min value
/* 089 */ WORD    wEXPPdl2Max;                // max value
/* 090 */ WORD    wEXPPdl3Assign;             // param code assigned to exp pdl 3
/* 091 */ WORD    wEXPPdl3Position; /*!*/     // ??
/* 092 */ WORD    wEXPPdl3Min;                // min value
/* 093 */ WORD    wEXPPdl3Max;                // max value
/* 094 */ WORD    wLFO1Assign;                // parameter code assigned to LFO1
/* 095 */ WORD    wLFO1Position;    /*!*/     // ??
/* 096 */ WORD    wLFO1Min;                   // lfo1 min value
/* 097 */ WORD    wLFO1Max;                   // lfo1 max value
/* 098 */ WORD    wLFO1Speed;                 // lfo1 speed in from 0.5 to 10.0 Hz 0 - 0xB9
/* 099 */ WORD    wLFO1WaveForm;              // wave form 0 - triangle, 1 - sine, 2 - square
/* 100 */ WORD    wLFO2Assign;                // parameter code assigned to LFO2
/* 101 */ WORD    wLFO2Position;    /*!*/     // ??
/* 102 */ WORD    wLFO2Min;                   // lfo2 min value
/* 103 */ WORD    wLFO2Max;                   // lfo2 max value
/* 104 */ WORD    wLFO2Speed;                 // lfo2 speed in from 0.5 to 10.0 Hz 0 - 0xB9
/* 105 */ WORD    wLFO2WaveForm;              // wave form 0 - triangle, 1 - sine, 2 - square
/* 106 */ WORD    wAmpChannelFootSwitch;      // 0 - 3 : CH1->CH2, CH1->WARP, CH2->WARP, C1->C2->WARP
/* 107 */ WORD    wCTRLA_Type;                // 0 - toggle 1 - momentary
/* 108 */ WORD    wCTRLA_Lnk1_Assign;         // param code assigned
/* 109 */ WORD    wCTRLA_Lnk1_Pos;    /*!*/   // ?? position
/* 110 */ WORD    wCTRLA_Lnk1_Min;            // min value
/* 111 */ WORD    wCTRLA_Lnk1_Max;            // max value
/* 112 */ WORD    wCTRLA_Lnk2_Assign;         // param code assigned
/* 113 */ WORD    wCTRLA_Lnk2_Pos;    /*!*/   // ?? position
/* 114 */ WORD    wCTRLA_Lnk2_Min;            // min value
/* 115 */ WORD    wCTRLA_Lnk2_Max;            // max value
/* 116 */ WORD    wCTRLA_Lnk3_Assign;         // param code assigned
/* 117 */ WORD    wCTRLA_Lnk3_Pos;            // ?? position
/* 118 */ WORD    wCTRLA_Lnk3_Min;            // min value
/* 119 */ WORD    wCTRLA_Lnk3_Max;            // max value
/* 120 */ WORD    wFS_TAPIT_Mode;     /*!*/   // ??
/* 121 */ WORD    wMODIFIED;          /*!*/   // ??
/* 122 */ WORD    wDELAY_Spread;              // 0 - 49
/* 123 */ WORD    wPICKUP_OnOff;              // 0 - 1 - corrected from DT!
/* 124 */ WORD    wGreen_EQUALIZER_OnOff;     // 0 - 1
/* 125 */ WORD    wGreen_Presence;            // 0 - 24 (-+12)
/* 126 */ WORD    wRed_EQUALIZER_OnOff;       // 0 - 1
/* 127 */ WORD    wRed_Presence;              // 0 - 24 (-+12)
/* 128 */ WORD    wVSWITCH_State;     /*!*/   // ??
/* 129 */ WORD    wPresetLevel;               // 0 - 99
/* 130 */ WORD    wCTRLB_Type;                // 0 - 1
/* 131 */ WORD    wCTRLB_Lnk1_Assign;         // param code assigned
/* 132 */ WORD    wCTRLB_Lnk1_Pos;    /*!*/   // ??
/* 133 */ WORD    wCTRLB_Lnk1_Min;            // min value
/* 134 */ WORD    wCTRLB_Lnk1_Max;            // max value
/* 135 */ WORD    wCTRLB_Lnk2_Assign;         // param code assigned
/* 136 */ WORD    wCTRLB_Lnk2_Pos;    /*!*/   // ??
/* 137 */ WORD    wCTRLB_Lnk2_Min;            // min value
/* 138 */ WORD    wCTRLB_Lnk2_Max;            // max value
/* 139 */ WORD    wCTRLB_Lnk3_Assign;         // param code assigned
/* 140 */ WORD    wCTRLB_Lnk3_Pos;    /*!*/   // ??
/* 141 */ WORD    wCTRLB_Lnk3_Min;            // min value
/* 142 */ WORD    wCTRLB_Lnk3_Max;            // max value
/* 143 */ WORD    wCTRLC_Type;                // 0 - 1
/* 144 */ WORD    wCTRLC_Lnk1_Assign;         // param code assigned
/* 145 */ WORD    wCTRLC_Lnk1_Pos;    /*!*/   // ??
/* 146 */ WORD    wCTRLC_Lnk1_Min;            // min value
/* 147 */ WORD    wCTRLC_Lnk1_Max;            // max value
/* 148 */ WORD    wCTRLC_Lnk2_Assign;         // param code assigned
/* 149 */ WORD    wCTRLC_Lnk2_Pos;    /*!*/   // ??
/* 150 */ WORD    wCTRLC_Lnk2_Min;            // min value
/* 151 */ WORD    wCTRLC_Lnk2_Max;            // max value
/* 152 */ WORD    wCTRLC_Lnk3_Assign;         // param code assigned
/* 153 */ WORD    wCTRLC_Lnk3_Pos;    /*!*/   // ??
/* 154 */ WORD    wCTRLC_Lnk3_Min;            // min value
/* 155 */ WORD    wCTRLC_Lnk3_Max;            // max value
/* 156 */ WORD    wVSW_FS_Type;
/* 157 */ WORD    wVSW1_FS_Param;
/* 158 */ WORD    wVSW1_FS_Pos;
/* 159 */ WORD    wVSW1_FS_Min;
/* 160 */ WORD    wVSW1_FS_Max;
/* 161 */ WORD    wVSW2_FS_Param;
/* 162 */ WORD    wVSW2_FS_Pos;
/* 163 */ WORD    wVSW2_FS_Min;
/* 164 */ WORD    wVSW2_FS_Max;
/* 165 */ WORD    wVSW3_FS_Param;
/* 166 */ WORD    wVSW3_FS_Pos;
/* 167 */ WORD    wVSW3_FS_Min;
/* 168 */ WORD    wVSW3_FS_Max;
/* 169 */ WORD    wWAH_Pdl1_Param;
/* 170 */ WORD    wWAH_Pdl1_Pos;
/* 171 */ WORD    wWAH_Pdl1_Min;             // 0 - 99
/* 172 */ WORD    wWAH_Pdl1_Max;             // 0 - 99
/* 173 */ WORD    wWAH_Pdl2_Param;
/* 174 */ WORD    wWAH_Pdl2_Pos;
/* 175 */ WORD    wWAH_Pdl2_Min;
/* 176 */ WORD    wWAH_Pdl2_Max;
/* 177 */ WORD    wWAH_Pdl3_Param;
/* 178 */ WORD    wWAH_Pdl3_Pos;
/* 179 */ WORD    wWAH_Pdl3_Min;
/* 180 */ WORD    wWAH_Pdl3_Max;
    WCHAR   wszName[GNX_MAXNAME_LEN];     // preset name: 10 symbols + null terminator

    //BYTE    bAmp1Data[788];               // amp 1 emulation data - exactly matches data from g4p file (Base64-encoded)
    //WCHAR   wszAmp1Name[GNX_MAXNAME_LEN]; // amplifier 1 name + null terminator
    GNX_AMP       Amp1;
    WORD          wAmp1Flag;                    // seems to be always 0xFFFF in all standard presets

    //BYTE    bAmp2Data[788];               // amp 2 emulation data - exactly matches data from g4p file (Base64-encoded)
    //WCHAR   wszAmp2Name[GNX_MAXNAME_LEN]; // amplifier 2 name + null terminator
    GNX_AMP       Amp2;
    WORD          wAmp2Flag;                    // seems to be always 0xFFFF in all standard presets

    WORD    Cab1Data[NUM_CAB_ZREGS];      // cabinet 1 emulation data - exactly matches data from g4p file (Base64-encoded)
    WCHAR   wszCab1Name[GNX_MAXNAME_LEN]; // cab 1 name + null terminator
    WORD    Cab2Data[NUM_CAB_ZREGS];      // cabinet 2 emulation data - exactly matches data from g4p file (Base64-encoded)
    WCHAR   wszCab2Name[GNX_MAXNAME_LEN]; // cab 2 name + null terminator

    PROGRAM_EQ  ToneEq;                   // udated from digitech sources
} GNX4Preset, PRESET;

typedef PRESET* LPPRESET;


#pragma pack()

#define GNX_MAX_PRESETS 80


//////////////////////////////////////////////////////////////////////////
// gp4 preset file parameters ID:
// many values are duplicated - means, that several different params
// can be stored under the same ID...

#define GP4_Pickup_Type             64      // 0x00000040
#define GP4_Pickup_Enable           65      // 0x00000041

#define GP4_Wah_Type                128     // 0x00000080
#define GP4_Wah_Enable              129     // 0x00000081
#define GP4_Wah_Position            132     // 0x00000084

#define GP4_Compressor_Enable       193     // 0x000000C1
#define GP4_Compressor_Attack       194     // 0x000000C2
#define GP4_Compressor_Ratio        195     // 0x000000C3
#define GP4_Compressor_Threshold    200     // 0x000000C8
#define GP4_Compressor_Gain         201     // 0x000000C9

#define GP4_Amp_Channel             260     // 0x00000104
#define GP4_Warp                    261     // 0x00000105
#define GP4_Amp_Warp                262     // 0x00000106
#define GP4_Cabinet_Warp            263     // 0x00000107
#define GP4_Channel_FS_Mode         264     // 0x00000108

#define GP4_Gate_Type               704     // 0x000002C0
#define GP4_Gate_Enable             705     // 0x000002C1
#define GP4_Gate_Attack             706     // 0x000002C2
#define GP4_Gate_Threshold          710     // 0x000002C6
#define GP4_Gate_Pluck_Sens         711

#define GP4_Wham_IPS_Mod_Type       768     // 0x00000300
#define GP4_Wham_IPS_Mod_Enable     769     // 0x00000301

#define GP4_Chorus_Level            836
#define GP4_Chorus_Speed            837
#define GP4_Chorus_Depth            838
#define GP4_Chorus_Predelay         839
#define GP4_Chorus_Waveform         840
#define GP4_Chorus_Balance          841

#define GP4_Flanger_Mix             901
#define GP4_Flanger_Speed           902
#define GP4_Flanger_Depth           903
#define GP4_Flanger_Regen           904
#define GP4_Flanger_Waveform        905
#define GP4_Flanger_Balance         906

#define GP4_Phaser_Speed            962
#define GP4_Phaser_Depth            963
#define GP4_Phaser_Level            965
#define GP4_Phaser_Regen            966
#define GP4_Phaser_Waveform         967
#define GP4_Phaser_Balance          969

#define GP4_Trig_Flanger_LFO_Start  1028
#define GP4_Trig_Flanger_Mix        1029
#define GP4_Trig_Flanger_Speed      1030
#define GP4_Trig_Flanger_Sens       1031

#define GP4_Trig_Phaser_LFO_Start   1092
#define GP4_Trig_Phaser_Mix         1093
#define GP4_Trig_Phaser_Speed       1094
#define GP4_Trig_Phaser_Sens        1095

#define GP4_Tremolo_Depth           1155    // 0x00000483
#define GP4_Tremolo_Speed           1156    // 0x00000484
#define GP4_Tremolo_Waveform        1157    // 0x00000485

#define GP4_Panner_Depth            1219
#define GP4_Panner_Speed            1220
#define GP4_Panner_Waveform         1221

#define GP4_Vibrato_Speed           1284
#define GP4_Vibrato_Depth           1285
#define GP4_Vibrato_Waveform        1286

#define GP4_Rotary_Speed            1346
#define GP4_Rotary_Depth            1348
#define GP4_Rotary_Mix              1349
#define GP4_Rotary_Doppler          1350
#define GP4_Rotary_X_Over           1351
#define GP4_Rotary_Balance          1352

#define GP4_YaYa_Pedal              1410
#define GP4_YaYa_Range              1412
#define GP4_YaYa_Mix                1413
#define GP4_YaYa_Depth              1414
#define GP4_YaYa_Balance            1416

#define GP4_AutoYa_Range            1476
#define GP4_AutoYa_Mix              1477
#define GP4_AutoYa_Speed            1478
#define GP4_AutoYa_Depth            1479
#define GP4_AutoYa_Balance          1481

#define GP4_SynthTalk_Vox           1540
#define GP4_SynthTalk_Attack        1542
#define GP4_SynthTalk_Release       1543
#define GP4_SynthTalk_Sens          1544
#define GP4_SynthTalk_Balance       1545

#define GP4_Envelope_Mix            1604
#define GP4_Envelope_Range          1605
#define GP4_Envelope_Sens           1606
#define GP4_Envelope_Balance        1607

#define GP4_Detune_Level            1667    // 0x00000683
#define GP4_Detune_Amount           1668    // 0x00000686
#define GP4_Detune_Balance          1669
#define GP4_Detune_Amount2          1670    // ?????

#define GP4_Pitch_Shift_Amount      1730
#define GP4_Pitch_Shift_Level       1731
#define GP4_Pitch_Shift_Amount2     1732    // ?????
#define GP4_Pitch_Shift_Balance     1733

#define GP4_Whammy_Pedal            1795
#define GP4_Whammy_Mix              1796
#define GP4_Whammy_Amount           1797

#define GP4_Delay_Type              1856    // 0x00000740
#define GP4_Delay_Enable            1857    // 0x00000741
#define GP4_Delay_Level             1860    // 0x00000744
#define GP4_Delay_Time              1862    // 0x00000746
#define GP4_Delay_Feedback          1863    // 0x00000747
#define GP4_Delay_Duck_Thresh       1864    // 0x00000748
#define GP4_Delay_Duck_Atten        1865    // 0x00000749
#define GP4_Delay_Balance           1866
#define GP4_Delay_Spread            1867    // 0x0000074B

#define GP4_Reverb_Type             1920    // 0x00000780
#define GP4_Reverb_Enable           1921    // 0x00000781
#define GP4_Reverb_Predelay         1922    // 0x00000782
#define GP4_Reverb_Damping          1924    // 0x00000784
#define GP4_Reverb_Level            1925    // 0x00000785
#define GP4_Reverb_Decay            1927    // 0x00000787
#define GP4_Reverb_Balance          1928    // 0x00000788

#define GP4_Stompbox_Type           2432    // 0x00000980
#define GP4_Stompbox_Enable         2433    // 0x00000981
#define GP4_Stompbox_Drive          2434    // 0x00000982
#define GP4_Stompbox_Tone           2435    // 0x00000983
#define GP4_Stompbox_Level          2436    // 0x00000984
#define GP4_Stompbox_Distortion     2437
#define GP4_Stompbox_Filter         2438
#define GP4_Stompbox_Volume         2439
#define GP4_Stompbox_Distortion2    2440
#define GP4_Stompbox_Tone2          2441
#define GP4_Stompbox_Level2         2442
#define GP4_Stompbox_Gain           2443
#define GP4_Stompbox_Level3         2444
#define GP4_Stompbox_Sustain        2445
#define GP4_Stompbox_Tone3          2446
#define GP4_Stompbox_Volume2        2447
#define GP4_Stompbox_Drive2         2448
#define GP4_Stompbox_Level4         2449
#define GP4_Stompbox_Gain2          2450
#define GP4_Stompbox_Tone4          2451
#define GP4_Stompbox_Clean          2452
#define GP4_Stompbox_Volume3        2453
#define GP4_Stompbox_Gain3          2454
#define GP4_Stompbox_Butt           2455
#define GP4_Stompbox_Face           2456
#define GP4_Stompbox_Loud           2457
#define GP4_Stompbox_Fuzz           2458
#define GP4_Stompbox_Volume4        2459
#define GP4_Stompbox_Distortion3    2460
#define GP4_Stompbox_Mid_Freq       2461
#define GP4_Stompbox_Mid_Level      2462
#define GP4_Stompbox_Low            2463
#define GP4_Stompbox_High           2464
#define GP4_Stompbox_Level5         2465

#define GP4_Chan_Amp_Type           2496    // 0x000009C0
#define GP4_Chan_Amp_Gain           2497    // 0x000009C1
#define GP4_Chan_Amp_Level          2498    // 0x000009C2
#define GP4_Chan_Bass_Freq          2499    // 0x000009C3
#define GP4_Chan_Bass_Level         2500    // 0x000009C4
#define GP4_Chan_Mid_Freq           2501    // 0x000009C5
#define GP4_Chan_Mid_Level          2502    // 0x000009C6
#define GP4_Chan_Treble_Freq        2503    // 0x000009C7
#define GP4_Chan_Treble_Level       2504    // 0x000009C8
#define GP4_Chan_EQ_Enable          2505    // 0x000009C9
#define GP4_Chan_Presence           2506    // 0x000009CA
#define GP4_Chan_Cab_Type           2560    // 0x00000A00
#define GP4_Chan_Cab_Tuning         2561    // 0x00000A01

#define GP4_Preset_Level            2626    // 0x00000A42

#define GP4_IPS_Amount              2754
#define GP4_IPS_Scale               2755
#define GP4_IPS_Key                 2756
#define GP4_IPS_Level               2757

#define GP4_Talker_Mic_Level        2818

#define GP4_Pedal_Assign_1          8194    // 0x00002002
#define GP4_V_Switch_Pedal_Assign_1 8194    // 0x00002002

#define GP4_Pedal_Min_1             8195    // 0x00002003
#define GP4_Wah_Min                 8195    // 0x00002003

#define GP4_Pedal_Max_1             8196    // 0x00002004
#define GP4_Wah_Max                 8196    // 0x00002004

#define GP4_Pedal_Assign_2          8197    // 0x00002005
#define GP4_Pedal_Min_2             8198    // 0x00002006
#define GP4_Pedal_Max_2             8199    // 0x00002007
#define GP4_Pedal_Assign_3          8200    // 0x00002008
#define GP4_Pedal_Min_3             8201    // 0x00002009
#define GP4_Pedal_Max_3             8202    // 0x0000200A

#define GP4_LFO1_Assign             8258
#define GP4_LFO2_Assign             8258

#define GP4_LFO1_Min                8259
#define GP4_LFO2_Min                8259

#define GP4_LFO1_Max                8260
#define GP4_LFO2_Max                8260

#define GP4_LFO1_Speed              8262
#define GP4_LFO2_Speed              8262

#define GP4_LFO1_Waveform           8263    // 0x00002047
#define GP4_LFO2_Waveform           8263    // 0x00002047

#define GP4_V_Switch_Assign_1       8384    // 0x000020C0
#define GP4_Control_A_Assign_1      8384    // 0x000020C0
#define GP4_Control_B_Assign_1      8384    // 0x000020C0
#define GP4_Control_C_Assign_1      8384    // 0x000020C0

#define GP4_V_Switch_Min            8385    // 0x000020C1
#define GP4_Control_A_Min_1         8385    // 0x000020C1
#define GP4_Control_B_Min_1         8385    // 0x000020C1
#define GP4_Control_C_Min_1         8385    // 0x000020C1

#define GP4_V_Switch_Max            8386    // 0x000020C2
#define GP4_Control_A_Max_1         8386    // 0x000020C2
#define GP4_Control_B_Max_1         8386    // 0x000020C2
#define GP4_Control_C_Max_1         8386    // 0x000020C2

#define GP4_Control_A_Assign_2      8387
#define GP4_Control_B_Assign_2      8387
#define GP4_Control_C_Assign_2      8387

#define GP4_Control_A_Min_2         8388    // 0x000020C4
#define GP4_Control_B_Min_2         8388    // 0x000020C4
#define GP4_Control_C_Min_2         8388    // 0x000020C4

#define GP4_Control_A_Max_2         8389    // 0x000020C5
#define GP4_Control_B_Max_2         8389    // 0x000020C5
#define GP4_Control_C_Max_2         8389    // 0x000020C5

#define GP4_Control_A_Assign_3      8390    // 0x000020C6
#define GP4_Control_B_Assign_3      8390    // 0x000020C6
#define GP4_Control_C_Assign_3      8390    // 0x000020C6

#define GP4_Control_A_Min_3         8391    // 0x000020C7
#define GP4_Control_B_Min_3         8391    // 0x000020C7
#define GP4_Control_C_Min_3         8391    // 0x000020C7

#define GP4_Control_A_Max_3         8392    // 0x000020C8
#define GP4_Control_B_Max_3         8392    // 0x000020C8
#define GP4_Control_C_Max_3         8392    // 0x000020C8

#define GP4_V_Switch_Type           8393    // 0x000020C9
#define GP4_Control_A_Type          8393    // 0x000020C9
#define GP4_Control_B_Type          8393    // 0x000020C9
#define GP4_Control_C_Type          8393    // 0x000020C9

#define GP4_V_Switch_Enable         8449    // 0x00002101

#endif // __GNX4_H__;